Drive Win32 composition effects from RenderTargetSceneInfo on the render thread - #22114
Drive Win32 composition effects from RenderTargetSceneInfo on the render thread#22114kekekeks wants to merge 3 commits into
Conversation
…der thread Adds an opaque CompositionTarget.TopLevelSpecificSceneInfo bag (with the corresponding ITopLevelImpl property and changed callback) that travels through the composition transport and arrives in RenderTargetSceneInfo. The Win32 backend publishes the theme variant through it. The WinUI/DComp composited window render targets now apply blur/mica visual state in BeginDraw, based on the transparency level and theme variant from the scene info, inside the same transaction as the frame. The UI-thread ICompositionEffectsSurface.SetBlur path is removed, so effect changes can no longer race the render thread and produce frames with mismatched alpha mode and blur state. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TrfgSxPjyUvvKsAPFZoLR1
|
You can test this PR using the following package version. |
| // TopLevelSpecificSceneInfo is an opaque immutable object provided by the platform's | ||
| // ITopLevelImpl.TopLevelSpecificSceneInfo. |
There was a problem hiding this comment.
Please use xml docs here. As it's currently written, it both explains a specific property and doesn't do it properly.
| // TopLevelSpecificSceneInfo is an opaque immutable object provided by the platform's | ||
| // ITopLevelImpl.TopLevelSpecificSceneInfo. | ||
| public record struct RenderTargetSceneInfo(PixelSize Size, double Scaling, Size LogicalSize, | ||
| CompositionTransparencyLevel TransparencyLevel, object? TopLevelSpecificSceneInfo = null) |
There was a problem hiding this comment.
TransparencyLevel is also a TopLevelSpecificSceneInfo of sorts, no. Would it make sense to reduce parameters? It's a private API as I can see
There was a problem hiding this comment.
PlatformThemeVariant specifically is a something that we have in every backend. It's just that only Win32 reads surface it (same for TransparencyLevel I think?)
There was a problem hiding this comment.
So whole SceneInfo could be a record class, not an object, with platform specific overrides (if necessary)
There was a problem hiding this comment.
I assume WinUICompositionBackdropCornerRadius could be a win-specific top-level scene info in the future (not for this PR obv)
| // TopLevelSpecificSceneInfo is an opaque immutable object provided by the platform's | ||
| // ITopLevelImpl.TopLevelSpecificSceneInfo. | ||
| public record struct RenderTargetSceneInfo(PixelSize Size, double Scaling, Size LogicalSize, | ||
| CompositionTransparencyLevel TransparencyLevel, object? TopLevelSpecificSceneInfo = null) |
There was a problem hiding this comment.
TopLevelSpecificSceneInfo -> TopLevelSceneInfo? I know it's a private API but still could be less verbose.
Right now we can present frames in a torn state:
The PR makes win32 backend to derive state from RenderTargetSceneInfo passed by compositor that now also holds the theme variant hint needed for mica theme selection. Since theme variant isn't something we care about across platforms, it's carried via new opaque platform-speciic RenderTargetSceneInfo field.